package net.wenku8.reader.entity

data class ApiResult<T>(
    var code : Int = 200,
    var message : String? = null,
    var data : T? = null
){
    companion object {
        fun <T> success(data: T): ApiResult<T> {
            return ApiResult(data = data);
        }
        fun <T> fail(message: String?): ApiResult<T> {
            return ApiResult(code = 100, message = message?:"请求失败");
        }

        fun <T> isSuccess(apiResult: ApiResult<T>?):Boolean{
            return apiResult != null && apiResult.code == 200
        }
    }


}